package com.fix.websocket;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;


@Component
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer{
	
	//消息处理器
	@Autowired
	private ChatWebSocketHandler webSocketHandler;
	//消息拦截器
	@Autowired
	private ChatHandShakeInterceptor chatInterceptor;

	@Override
	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
		registry.addHandler(webSocketHandler, "/ws").addInterceptors(chatInterceptor);
	}

}
